Skip to content

fix: prefer platform-python over python3 to match waagent interpreter on RHEL 8#2154

Open
johnsirmon wants to merge 1 commit intoAzure:masterfrom
johnsirmon:johnsirmon-rehel8-platform-python-interpreter
Open

fix: prefer platform-python over python3 to match waagent interpreter on RHEL 8#2154
johnsirmon wants to merge 1 commit intoAzure:masterfrom
johnsirmon:johnsirmon-rehel8-platform-python-interpreter

Conversation

@johnsirmon
Copy link

on RHEL 8

On RHEL 8, /usr/libexec/platform-python is the interpreter used by waagent and has the required modules installed. The previous logic selected python3 first, which may lack those modules, causing agent.py to fail with import errors. Moving platform-python to the top of the check order ensures AMA uses the same interpreter as waagent.

Fixes #2117

… on RHEL 8

On RHEL 8, /usr/libexec/platform-python is the interpreter used by waagent
and has the required modules installed. The previous logic selected python3
first, which may lack those modules, causing agent.py to fail with import
errors. Moving platform-python to the top of the check order ensures AMA
uses the same interpreter as waagent.

Fixes Azure#2117
@johnsirmon johnsirmon requested a review from a team as a code owner March 9, 2026 20:59
local python_exec_command=$1

if command -v python3 >/dev/null 2>&1 ; then
if command -v /usr/libexec/platform-python >/dev/null 2>&1 ; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it ok to check in this order for non-RHEL8 distros?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — with one caveat: this changes behavior only on systems where /usr/libexec/platform-python actually exists. If that path is not present, the logic still falls through to python3 and then python2 as before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AzureMonitorAgent shim.sh not working on RHEL8 when different python3/2 is installed

2 participants